package gui.menu.actions;

import gui.Frame;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Icon;
import javax.swing.ImageIcon;

public class SaveAction extends AbstractAction
{
   private static Icon icon = new ImageIcon("icons/save.png");
   /**
    * 
    */
   private static final long serialVersionUID = 1L;
   private Frame frame;
   /** Create this action for the given frame */
   public SaveAction(Frame frame)
   {
      super("Save",icon);
      this.frame = frame;
   }

   @Override
   public void actionPerformed(ActionEvent arg0)
   {
      // TODO Auto-generated method stub

      frame.saveFile(frame.getFile());
      //      File file = frame.getFile();
      //      if (file != null)
      //      {
      //         if (frame.isModified())
      //         {
      ////            frame.saveFile();
      //            new WriteFile(file, frame);
      //         }
      //      }
      //      else
      //      {
      //         new SaveAsAction(frame).actionPerformed(arg0);
      //      }

   }

}
